import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { UserShopVO, UserShopForm, UserShopQuery } from '@/api/system/userConsum/types';

/**
 * 查询每个用户在店铺下得消费累计实付金额列表
 * @param query
 * @returns {*}
 */

export const listUserShop = (query?: UserShopQuery): AxiosPromise<UserShopVO[]> => {
  return request({
    url: '/system/userShop/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询每个用户在店铺下得消费累计实付金额详细
 * @param id
 */
export const getUserShop = (id: string | number): AxiosPromise<UserShopVO> => {
  return request({
    url: '/system/userShop/' + id,
    method: 'get'
  });
};

/**
 * 新增每个用户在店铺下得消费累计实付金额
 * @param data
 */
export const addUserShop = (data: UserShopForm) => {
  return request({
    url: '/system/userShop',
    method: 'post',
    data: data
  });
};

/**
 * 修改每个用户在店铺下得消费累计实付金额
 * @param data
 */
export const updateUserShop = (data: UserShopForm) => {
  return request({
    url: '/system/userShop',
    method: 'put',
    data: data
  });
};

/**
 * 删除每个用户在店铺下得消费累计实付金额
 * @param id
 */
export const delUserShop = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/userShop/' + id,
    method: 'delete'
  });
};
